import {
  getSharedFilesDataReturnValue,
  shareFilesReturnValue,
} from "@/types/share";
import { GeneralReturnValue } from "@/types/general";
import http from "@/utils/axios";

/**
 * 获取分享文件列表
 * @param data 页码,分页大小
 * @returns
 */
export const getSharedFilesAPI = (data: { pageNo: string; pageSize: string }) =>
  http<getSharedFilesDataReturnValue>({
    url: "/share/loadShareList",
    method: "POST",
    data,
  });

/**
 * 分享文件
 * @param data 文件ID,分享失效类型
 * @returns
 */
export const shareFilesAPI = (data: { fileId: string; validType: string }) =>
  http<shareFilesReturnValue>({
    url: "/share/shareFile",
    method: "POST",
    data,
  });

/**
 * 取消分享
 * @param data 取消分享的ID,多个逗号隔开
 * @returns 
 */
export const stopShareAPI = (data: { shareIds: string }) =>
  http<GeneralReturnValue>({
    url: "/share/cancelShare",
    method: "POST",
    data,
  });
